// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Mint from 'mint-ui'
import 'mint-ui/lib/style.min.css'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
import './styles/index.less'
import axios from './api'
import filter from './utils/filter'
Vue.use(Mint)
Vue.use(VueAwesomeSwiper)
Vue.prototype.$http = axios
Vue.prototype.domin = 'http://cs.fengchenyixuan.cn'
Vue.config.productionTip = false

axios.defaults.timeout = 5000
axios.interceptors.response.use(
  response => {
    return response
  },
  error => {
    if (error.response) {
      switch (error.response.status) {
        case 500:
          Mint.toast({message: '系统错误，请联系管理员'})
          break
      }
    }
    return Promise.reject(
      error.response ? error.response.data : { message: '页面请求超时！' }
    ) // 返回接口返回的错误信息
  }
)
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  filter,
  template: '<App/>',
  components: { App }
})
